package cn.yuitstyle.fss.minio.demo;

import cn.yuitstyle.fss.minio.starter.exception.MinioFileException;
import com.shide.common.base.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author yuwg
 */
@RestControllerAdvice
@Slf4j
public class GlobalException {


    @ExceptionHandler(value = MinioFileException.class)
    @ResponseStatus(HttpStatus.OK)
    public R minioFileException(MinioFileException e) {
        log.error(e.getMessage(), e);
        return R.fail(e.getMessage());
    }
}
